package automateWebElements;

import org.openqa.selenium.firefox.FirefoxDriver;

public class Alerts {
    public static void main(String[] args) {
        FirefoxDriver driver = new FirefoxDriver();
        String text = "Cristian";
        driver.get("https://rahulshettyacademy.com/AutomationPractice/");
        driver.findElementById("name").sendKeys(text);
        driver.findElementByCssSelector("[id='alertbtn']").click();
        System.out.println(driver.switchTo().alert().getText());
        driver.switchTo().alert().accept();

        driver.findElementById("name").sendKeys(text);
        driver.findElementByCssSelector("[id='confirmbtn']").click();
        System.out.println(driver.switchTo().alert().getText());
        driver.switchTo().alert().dismiss();

    }
}
